import json

from ronglian_sms_sdk import SmsSDK

accId = '8aaf0708732220a60173fb58dbe55c4a'
accToken = 'e7daa6ac110141d2a2ee1fa48f475549'
appId = '8aaf0708732220a60173fb58dcc85c50'


def send_message(phone, datas):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'  # 测试模板id为: 1. 内容为: 【云通讯】您的验证码是{1}，请于{2}分钟内正确输入。
    # mobile = '19995522322'
    # datas = ('666777', '5')  # 模板中的参数按照位置传递
    resp = sdk.sendMessage(tid, phone, datas)
    resp_dict = json.loads(resp)
    if resp_dict.get('statusCode') == '000000':
        return '0'
    return '-1'


if __name__ == '__main__':
    print(send_message('19995522322', ('1234', '5')))
